package com.erclab.xbuilder.reporthelpers;

import java.util.ArrayList;

import com.erclab.internal.xpresso.datavalidators.DataValidationError;
import com.erclab.internal.xpresso.exceptions.ReportException;
import com.erclab.internal.xpresso.reports.Report;
import com.erclab.internal.xpresso.reports.ReportHelper;
import com.erclab.xbuilder.db.MysqlDatabaseManager;
import com.erclab.xbuilder.exception.DBManagerException;

public class UserObjectReportHelper implements ReportHelper {

	public void afterReportExecution(Report report) throws ReportException {
		

	}

	public void beforeReportExecution(Report report) throws ReportException {
		

	}

	public void processReportChanges(Report report, ArrayList keyvalues) throws ReportException, DataValidationError {
		// We need to drop the tables
		// TODO: We should check that the action is to delete - MAKE CHANGE IN XPRESSO.
		// TODO: We should also remove the report and report elements.
		String tableName = "";
		MysqlDatabaseManager mdm = new MysqlDatabaseManager();
		try {
			mdm.dropTable(tableName);
		} catch (DBManagerException e) {
			throw new ReportException("An error occurred dropping a table: " + e.getTheException());
		}

	}

}
